package cn.vcjf.washcar.api.order.entity;

import cn.vcjf.washcar.common.util.IdGen;
import cn.vcjf.washcar.common.web.PageModel;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
 * 洗车订单表
 * </p>
 *
 * @author zhengzihang
 * @since 2018-07-20
 */
@TableName("wash_car_order")
public class WashCarOrder extends PageModel {

    private static final long serialVersionUID = 1L;
    /**
     * 订单状态(1下单中,2下单成功,3下单失败,4支付成功,5支付失败,6已撤销)
     */
    public static int ORDER_UNDING=1;
    /**,2下单成功*/
    public static int ORDER_UNDING_SUCCESS=2;
    /**,3下单失败*/
    public static int ORDER_UNDING_FAIL=3;
    /**,4支付成功*/
    public static int ORDER_PAY_OK=4;
    /**,5支付失败*/
    public static int ORDER_PAY_FAIL=5;
    /**,6已撤销*/
    public static int ORDER_CANCEL=6;
    /**
     * 服务状态(1未服务,2服务中,3已服务)*/
    public static int ORDER_WATI_SERVER=1;
    /**,2下单成功*/
    public static int ORDER_IN_SERVER=2;
    /**,3下单失败*/
    public static int ORDER_SERVERED=3;


    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /**
     * 用户名称
     */
    @TableField(exist = false)
    private String userName;
    /**
     * 用户电话
     */
    @TableField(exist = false)
    private String userPhone;

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserPhone() {
        return userPhone;
    }

    public void setUserPhone(String userPhone) {
        this.userPhone = userPhone;
    }
    /**
     * 订单编号
     */
    private String orderNo;
    /**
     * 上游订单编号
     */
    private String pOrderNo;
    /**
     * 上游返回实体
     */
    private String pResult;

    /**
     * 用户id
     */
    private Integer userId;

    /**
     * 订单状态(1下单中,2下单成功,3支付成功,4支付失败,5已撤销,6)
     */
    private Integer status;

    /**
     * 服务类型(洗车类型)
     */
    private Integer serverType;

    /**
     * 服务状态
     */
    private Integer serviceStatus;

    /**
     * 洗车时间
     */
    private Integer washTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date washStartTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date washEndTime;

    /**
     * 订单类型(预约订单,)
     */
    private Integer orderType;

    /**
     * 洗车地点
     */
    private String washAddress;

    /**
     * 车辆信息
     */
    private String carInfo;

    /**
     * 洗车价格(单位)
     */
    private BigDecimal money;

    /**
     * 优惠价格(单位)
     */
    private BigDecimal discounts;

    /**
     * 洗车地点纬度
     */
    private Double latitude;
    /**
     * 支付数据,url,参数
     */
    private String payData;

    /**
     * 洗车地点经度
     */
    private Double longitude;

    /**
     * 用户留言
     */
    private String note;

    /**
     * 用户评论
     */
    private String comment;

    private Date payTime;

    public Date getPayTime() {
        return payTime;
    }

    public void setPayTime(Date payTime) {
        this.payTime = payTime;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }
    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }
    public Integer getUserId() {
        return userId;
    }

	public String getpOrderNo() {
		return pOrderNo;
	}

	public void setpOrderNo(String pOrderNo) {
		this.pOrderNo = pOrderNo;
	}

    public Integer getWashTime() {
        return washTime;
    }

    public void setWashTime(Integer washTime) {
        this.washTime = washTime;
    }

    public String getPayData() {
        return payData;
    }

    public void setPayData(String payData) {
        this.payData = payData;
    }

    public String getpResult() {
		return pResult;
	}

	public void setpResult(String pResult) {
		this.pResult = pResult;
	}

	public void setUserId(Integer userId) {
        this.userId = userId;
    }
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }
    public Integer getServerType() {
        return serverType;
    }

    public void setServerType(Integer serverType) {
        this.serverType = serverType;
    }
    public Integer getServiceStatus() {
        return serviceStatus;
    }

    public void setServiceStatus(Integer serviceStatus) {
        this.serviceStatus = serviceStatus;
    }
    public Integer getOrderType() {
        return orderType;
    }

    public Date getWashStartTime() {
        return washStartTime;
    }

    public void setWashStartTime(Date washStartTime) {
        this.washStartTime = washStartTime;
    }

    public Date getWashEndTime() {
        return washEndTime;
    }

    public void setWashEndTime(Date washEndTime) {
        this.washEndTime = washEndTime;
    }

    public void setOrderType(Integer orderType) {
        this.orderType = orderType;
    }
    public String getWashAddress() {
        return washAddress;
    }

    public void setWashAddress(String washAddress) {
        this.washAddress = washAddress;
    }
    public String getCarInfo() {
        return carInfo;
    }

    public void setCarInfo(String carInfo) {
        this.carInfo = carInfo;
    }
    public BigDecimal getMoney() {
        return money;
    }

    public void setMoney(BigDecimal money) {
        this.money = money;
    }
    public BigDecimal getDiscounts() {
        return discounts;
    }

    public void setDiscounts(BigDecimal discounts) {
        this.discounts = discounts;
    }
    public Double getLatitude() {
        return latitude;
    }

    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }
    public Double getLongitude() {
        return longitude;
    }

    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }
    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }
    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    @Override
    public void preInsert(){
        this.setOrderNo(IdGen.getAutoOrderNo());
        super.preInsert();
    }

    @Override
    public String toString() {
        return "WashCarOrder{" +
        "id=" + id +
        ", orderNo=" + orderNo +
        ", userId=" + userId +
        ", status=" + status +
        ", serverType=" + serverType +
        ", washTime=" + washTime +
        ", serviceStatus=" + serviceStatus +
        ", washStartTime=" + washStartTime +
        ", washEndTime=" + washEndTime +
        ", orderType=" + orderType +
        ", washAddress=" + washAddress +
        ", carInfo=" + carInfo +
        ", money=" + money +
        ", discounts=" + discounts +
        ", latitude=" + latitude +
        ", longitude=" + longitude +
        ", note=" + note +
        ", comment=" + comment +
        ", createUser=" + createUser +
        ", createTime=" + createTime +
        ", updateUser=" + updateUser +
        ", updateTime=" + updateTime +
        ", deleteFlag=" + deleteFlag +
        "}";
    }
}
